import { reactRouter } from "@react-router/dev/vite";
import autoprefixer from "autoprefixer";
import tailwindcss from "tailwindcss";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { glob } from 'glob';


export default defineConfig({
  css: {
    postcss: {
      plugins: [tailwindcss, autoprefixer],
    },
    preprocessorOptions: {
      scss: {
        additionalData: `@import "@adobe/react-spectrum/dist/vars/spectrum-global.css";`,
      },
    },
  },
  plugins: [reactRouter(), tsconfigPaths(),],

  ssr: {
    noExternal: [
      '@adobe/react-spectrum',
      '@react-spectrum/*',
      '@spectrum-icons/*'
    ].flatMap((spec) => glob.sync(`${spec}`, { cwd: 'node_modules/' }))
  }

});